package com.treasure.infrastructure.index.loader;

import org.elasticsearch.common.Strings;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author sunhongmin
 * @date 2023/8/25 20:08
 * @description
 */
public class ESSegmentLoader extends AbsSegmentLoader {

    @Override
    public List<String> passagesSplit(String resourceText) {
        if (!Strings.hasLength(resourceText)) {
            return Collections.emptyList();
        }
        return Arrays.stream(resourceText.split("\n\n")).collect(Collectors.toList());
    }
}
